﻿define(function (require) {
    var service = require('ezdesk/utility/service');

    window.Project = Backbone.Model.extend({
        initialize: function () {
            var status = this.get('Status');
            var dateDiff = this.get('DateDiff');
            
            if (status == "Archive")
                this.set({ 'ProjectDiff': '<span style="color: #3ba365;">' + '已关闭' + '</span>' });
            else if (dateDiff == null)
                this.set({ 'ProjectDiff': '<span>没有计划</span>'});
            else if (dateDiff < 0)
                this.set({ 'ProjectDiff': '<span>剩余' + -dateDiff + '天</span>' });
            else if(dateDiff > 0 )
                this.set({ 'ProjectDiff': '<span style="color: #fa0000;">过期' + dateDiff + '天</span>'});
            else
                this.set({ 'ProjectDiff': '<span style="color: #000000;">今天到期</span>' });
        }
    });

});
